<template>
	<view class=" v100  overauto  bgcover no-repeat"
		:style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
		<u-sticky>
			<view class="zdex9 bgdce6fe">
				<view class="" :style="{'paddingTop':statusBarHeigh + 'px',}">
					<view class="flex alicen pl20" :style="{'height':menuButtonInfo.height + 'px',}">
						<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
						<view class="w30b"></view>
						<view class=" fz30 col00 bold">志愿表</view>
					</view>
				</view>
				<view class="flex pl10 pt20 pb20 pr20 alicen between">
					<view class="flex alicen fz28" @tap="selectAll('c')">
						<text class="w20 h20 ius100 bg4c85f7 mr10"></text>
						<view :class="{'col40':curri == 'c'}">
							<text>冲</text>
							<text>({{all.c}})</text>
						</view>
					</view>
					<view class="flex alicen fz28" @tap.stop="selectAll('z')">
						<text class="w20 h20 ius100 bg0055ff mr10"></text>
						<view :class="{'col40':curri == 'z'}">

							<text>争</text>
							<text>({{all.z}})</text>
						</view>

					</view>
					<view class="flex alicen fz28" @tap.stop="selectAll('w')">
						<text class="w20 h20 ius100 bgf0ad4e mr10"></text>
						<view :class="{'col40':curri == 'w'}">

							<text>稳</text>
							<text>({{all.w}})</text>
						</view>
					</view>
					<view class="flex alicen fz28" @tap.stop="selectAll('s')">
						<text class="w20 h20 ius100 bg8b1fe7 mr10"></text>
						<view :class="{'col40':curri == 's'}">
							<text>守</text>
							<text>({{all.s}})</text>
						</view>

					</view>
					<view class="flex alicen fz28" @tap.stop="selectAll('b')">
						<text class="w20 h20 ius100 bg03c698 mr10"></text>
						<view :class="{'col40':curri == 'b'}">
							<text>保</text>
							<text>({{all.b}})</text>
						</view>
					</view>
				</view>
			</view>
		</u-sticky>
		<scroll-view scroll-y="true" class="hcalc">
			<block v-if="deillist.length > 0">
				<view class="pl20 pr20 mb20" v-for="(item,index) in deillist" :key="index">
					<view class="pt20 pb20 pl20 pr20 bgfff col33 ius10">
						<view class="flex alicen between colb6">
							<view class="fz30 mt10 mb10">第 <text
									class="pt8 pb8 pl20 pr20 border1 boree">{{index+1}}</text>志愿
							</view>
							<view class="fz28 col40" @tap.stop="detail(item,index+1)">详情</view>
						</view>
						<view class="bgfff border1 boree">
							<view class="flex alicen  fz28">
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom">省市:{{filprovince(list1,item.province)}}</view>
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom bdl1-left1">院校:{{item.schoolName}}
								</view>
							</view>
							<view class="flex alicen  fz28">
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom">院校代码:{{item.schoolCode}}</view>
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom bdl1-left1">全国排名:{{item.qgRank}}
								</view>
							</view>
							<view class="flex alicen  fz28">
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom">专业组:{{item.zyzCode}}</view>
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom bdl1-left1">
									投档概率:{{parseFloat(item.rateSumit)}}%
								</view>
							</view>
							<view class="flex alicen  fz28">
								<view class="pt20 pb20 flex1 boree flexCenter bdr1_bottom bdl1-rigth1">
									招生计划人数:{{item.planNums||'--'}}
								</view>
								<view class=" flex1 boree flexCenter"></view>
							</view>
						</view>
					</view>
				</view>
			</block>
			<u-empty v-else mode="list" size="28"></u-empty>
		</scroll-view>
		<view class="w100b fixed  pb20" :style="{'bottom':safeAreaBottom.safeAreaInsets.bottom +'rpx'}">
			<view  class=" pt20 pb20 colff ml20 mr20 ius100 bgff000 flexCenter" @tap="savaBtn">保存</view>
		</view>
		
		<view class="bgfff w100b fixed b0" :style="{ 'height': `${safeAreaBottom.safeAreaInsets.bottom}` +'px'}">
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sffIdx: 0,
				deillist: [],
				deilObj: {},
				id: '',
				all: {},
				curri: 'c',
				list1:[],//省的数组
			}
		},
		// onLoad() {
		// 	this.KeyAddZytb();
		// 	this.provinceList();
		// },
		onShow() {
			this.KeyAddZytb();
			this.provinceList();
		},
		methods: {
			async provinceList(){
				let params = {
					scrollstr:true
				}
				this.list1 = await this.request.get('/api/children/list',{params})
			},
			selectAll(i) {
				if (this.curri == i) return;
				this.curri = i
				this.KeyAddZytb();

			},
			async savaBtn(){
				let params = {
					pcId:this.deillist[0].pcId
				}
				let data = await this.request.get('/api/saveOneKeyAddZytb',{params})
				console.log('data',data)
				if(data.code == 200){
					this.successToShow(data.msg||'保存成功',call=>{
						this.redirectTo('/pages/shortcut/shortcut')
					});
				}
			},
			detail(item,index){
				this.navgateTo('/pages/shortcut/detail',{item:JSON.stringify(item),index:index})
			},
			async KeyAddZytb() {
				let params = {
					pcId:this.readData('pcid'),
					userId: this.readData('useId')
				}
				let deil = await this.request.get('/api/oneKeyAddZytb', {
					params
				})
				if (deil.code == 200) {
					this.all = deil.data
					this.deillist = []
					if (this.curri == 'c') {
						this.deillist = deil.data.tbListc
					}
					if (this.curri == 'z') {
						this.deillist = deil.data.tbListz
					}
					if (this.curri == 'w') {
						this.deillist = deil.data.tbListw
					}
					if (this.curri == 's') {
						this.deillist = deil.data.tbLists
					}
					if (this.curri == 'b') {
						this.deillist = deil.data.tbListb
					}

				}
			}
		}

	}
</script>

<style lang="scss">
	.hcalc{
		height: calc(100vh - 280rpx);
		overflow: auto;
	}
</style>